#ifndef __OSAPI_H__
#define __OSAPI_H__

#include "plat/nonecopyable.h"
#include "mutexbase.h"

class OsApi : public NoneCopyable
{
private:
    explicit OsApi();

public:
    static bool KernelIsRunning();
    static void KernelInitialize();
    static void KernelStart();
    static void KernelLock();
    static void KernelUnLock();
    static void KernelSuspend();
    static void KernelResume(uint32_t sleep_ticks);

    static uint32_t KernelEnterCritical();
    static void KernelExitCritical(uint32_t ret);
    
    inline static void KernelCriticalFunc(const std::function<void(void)> &func)
    {
        uint32_t ret = KernelEnterCritical();

        func();
        KernelExitCritical(ret);
    }

    static bool IsIRQ();
};

#endif // __OSAPI_H__
